{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "39fb6492-fc04-4b04-9549-37773f8d176b",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " * Serving Flask app '__main__' (lazy loading)\n",
      " * Environment: production\n",
      "\u001b[31m   WARNING: This is a development server. Do not use it in a production deployment.\u001b[0m\n",
      "\u001b[2m   Use a production WSGI server instead.\u001b[0m\n",
      " * Debug mode: off\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " * Running on http://127.0.0.1:5001/ (Press CTRL+C to quit)\n",
      "127.0.0.1 - - [25/Oct/2021 09:51:39] \"GET / HTTP/1.1\" 200 -\n",
      "127.0.0.1 - - [25/Oct/2021 09:51:39] \"GET /static/js/echarts.min.js HTTP/1.1\" 304 -\n",
      "127.0.0.1 - - [25/Oct/2021 09:51:57] \"GET /bar HTTP/1.1\" 200 -\n",
      "127.0.0.1 - - [25/Oct/2021 09:51:58] \"GET /static/js/echarts.min.js HTTP/1.1\" 304 -\n",
      "127.0.0.1 - - [25/Oct/2021 09:52:25] \"GET /can HTTP/1.1\" 200 -\n",
      "127.0.0.1 - - [25/Oct/2021 09:52:25] \"GET /static/js/echarts.min.js HTTP/1.1\" 304 -\n",
      "127.0.0.1 - - [25/Oct/2021 09:52:31] \"GET /pie HTTP/1.1\" 200 -\n",
      "127.0.0.1 - - [25/Oct/2021 09:52:32] \"GET /static/js/echarts.min.js HTTP/1.1\" 304 -\n",
      "127.0.0.1 - - [25/Oct/2021 09:52:47] \"GET / HTTP/1.1\" 200 -\n",
      "127.0.0.1 - - [25/Oct/2021 09:52:47] \"GET /static/js/echarts.min.js HTTP/1.1\" 304 -\n",
      "127.0.0.1 - - [25/Oct/2021 09:53:40] \"GET /bar HTTP/1.1\" 200 -\n",
      "127.0.0.1 - - [25/Oct/2021 09:53:40] \"GET /static/js/echarts.min.js HTTP/1.1\" 304 -\n",
      "127.0.0.1 - - [25/Oct/2021 09:54:08] \"GET /can HTTP/1.1\" 200 -\n",
      "127.0.0.1 - - [25/Oct/2021 09:54:08] \"GET /static/js/echarts.min.js HTTP/1.1\" 304 -\n",
      "127.0.0.1 - - [25/Oct/2021 09:54:44] \"GET /pie HTTP/1.1\" 200 -\n",
      "127.0.0.1 - - [25/Oct/2021 09:54:44] \"GET /static/js/echarts.min.js HTTP/1.1\" 304 -\n"
     ]
    }
   ],
   "source": [
    "from flask import Flask,render_template\n",
    "import pandas as pd\n",
    "\n",
    "app = Flask(__name__,template_folder='./templates',static_folder=\"./templates/static\")\n",
    "\n",
    "@app.route('/')\n",
    "def hello():\n",
    "    df = pd.read_csv(\"./source/data.csv\", sep=',',encoding='gbk')#读取表格\n",
    "    da = df.to_dict('list')#形成字典\n",
    "    keys = ','.join(da.keys())\n",
    "    #'项目名称,在途需求,未纳入项目,测试,测试完毕,开发,系统设计,需求分析,已纳入项目,已交付'\n",
    "    #变成列表\n",
    "    p = keys.split(',')\n",
    "    #['项目名称', '在途需求', '未纳入项目', '测试', '测试完毕', '开发', '系统设计', '需求分析', '已纳入项目', '已交付']\n",
    "    p0 = da[\"项目名称\"]\n",
    "    p1 = da[\"在途需求\"]\n",
    "    p2 = da[\"未纳入项目\"]\n",
    "    p3 = da[\"测试\"]\n",
    "    p4 = da[\"测试完毕\"]\n",
    "    p5 = da[\"开发\"]\n",
    "    p6 = da[\"系统设计\"]\n",
    "    p7 = da[\"需求分析\"]\n",
    "    p8 = da[\"已纳入项目\"]\n",
    "    p9 = da[\"已交付\"]\n",
    "    return render_template('template.html',data1=p[1:-1],data2=p0,data3=p1,data4=p2,data5=p3,\n",
    "                           data6=p4,data7=p5,data8=p6,data9=p7,data10=p8,data11=p9,name1=p[1],\n",
    "                           name2=p[2],name3=p[3],name4=p[4],name5=p[5],name6=p[6],name7=p[7],\n",
    "                           name8=p[8],name9=p[9])#传入login网页{{}}对应的值\n",
    "\n",
    "\n",
    "@app.route('/bar')\n",
    "def bar():\n",
    "    return render_template('bar-label-rotation.html')\n",
    "\n",
    "@app.route('/can')\n",
    "def can():\n",
    "    return render_template('candlestick-sh.html')\n",
    "\n",
    "@app.route('/pie')\n",
    "def pie():\n",
    "    return render_template('pie-custom.html')\n",
    "\n",
    "@app.route('/wate')\n",
    "def wate():\n",
    "    return render_template('watermark.html')\n",
    "\n",
    "\n",
    "if __name__ == \"__main__\":\n",
    "    app.run(port=5001)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "589aee31-f78d-4091-959c-8e67f472aab8",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
